
from kant.page import Page

class SpawnPage(Page):
    def __init__(self, command, pause=True, repeat=False, **kw):
        self.run = False
        self.pause = pause
        self.command = command
        self.repeat = repeat
        Page.__init__(self, **kw)

    def render(self):
        import os
        if self.repeat or not self.run:
            os.spawnl(True, "/bin/sh", "-c", self.command)
            self.run = True
        Page.render(self)
        return True
